package com.itehima.File;

import java.io.File;
import java.io.IOException;

public class Prac01 {
    public static void main(String[] args) throws IOException {

        //综合练习1：

        //在当前模块下的aaa文件夹中创建一个a.txt

        File file1 = new File("20240414\\aaa");
        file1.mkdirs();//如果aaa存在就会创建失败，如果aaa不存在就会创建成功

        String child= "a.txt";
        File file2 = new File(file1, child);
        boolean b = file2.createNewFile();
        if(b)
            System.out.println("创建成功");
        else
            System.out.println("创建失败");

        System.out.println("--------------");
        File file3 = new File("E:\\ccc");
        file3.mkdirs();

        File file4 = new File(file3, "c.txt");
        boolean b3 = file4.createNewFile();
        if(b3)
            System.out.println("创建成功");
        else
            System.out.println("创建失败");
    }
}
